<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>搜索科室search.html</title>
	<link rel="stylesheet" type="text/css" href="css/aui.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<div class="search-container search-fixed">
	<div class="search-wrapper">
		<div class="search-icon">
			<i class="aui-iconfont aui-icon-search"></i>
		</div>
		<div class="search-input">
			<input placeholder="搜索科室" autocomplete="off" id="search-offics"/>
		</div>
	</div>
</div>

<div class="filter-container filter-fixed">
	<div class="filter-wrapper">
		<div class="filter-left">
			<h4>按区域</h4>
			<i class="arrow-down"></i>
		</div>
		<div class="filter-right">
			<div class="filter-item filter-item-active">
				<span>综合排序</span>
				<i class="filter-rank"></i>
			</div>
			<div class="filter-item">
				<span>按距离</span>
				<i class="filter-location"></i>
			</div>
		</div>
	</div>

	<div class="filter-area-list" style="display:none;">
<!--		<div class="filter-area-item filter-area-active">-->
<!--			<a href="javascript:;">全部</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">东城区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">西城区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">朝阳区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">丰台区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">石景山区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">海淀区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">门头沟区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">房山区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">通州区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">顺义区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">昌平区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">大兴区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">怀柔区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">平谷区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">密云区</a>-->
<!--		</div>-->
<!--		<div class="filter-area-item">-->
<!--			<a href="javascript:;">延庆区</a>-->
<!--		</div>-->
	</div>
</div>

<div class="common-list">
<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

<!--	<div class="common-item">-->
<!--		<div class="common-item-top">-->
<!--			<div class="common-logo">-->
<!--				<img src="/images/demo.png"/>-->
<!--			</div>-->
<!--			<div class="common-body">-->
<!--				<h4>北京协和医院</h4>-->
<!--				<span>三级甲等</span>-->
<!--			</div>-->
<!--		</div>-->

<!--		<div class="common-item-bottom">-->
<!--			<a>核酸检测1</a>-->
<!--			<a>核酸检测222</a>-->
<!--			<a>核酸检测2</a>-->
<!--			<a>核酸检测33333</a>-->
<!--			<a>核酸检测4</a>-->
<!--			<a>核酸检测33</a>-->
<!--			<a>核酸检测22</a>-->
<!--		</div>-->

<!--	</div>-->

</div>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/jquery-1.8.3.min.js"></script>
<script src="js/url.js"></script>
<script type="text/javascript">
	var officesName = decodeURI(location.href.split("=")[1]);
	$('.origin-list').css('paddingTop',120);

	$('.filter-item').click(function () {
		$('.filter-item').removeClass('filter-item-active');
		$(this).addClass('filter-item-active');
	})
	/*区域显示head*/
	$('.filter-left').click(function () {
		$.ajax({
			url:getUrl()+"wechat114/area/getArea",
			data:{"parentId":110100},
			dataType:"json",
			type:"get",
			success:function (data) {
				if (data.code == 0){
					var list = data.data;
					var str = "<div class=\"filter-area-item filter-area-active\">\n" +
							"          <a href=\"javascript:;\">全部</a>\n" +
							"        </div>";
					for (var i=0;i<list.length;i++){
						str += '<div class="filter-area-item">';
						str += '<a href="javascript:;">'+list[i].areaName+'</a>';
						str += "</div>";
					}
					$('.filter-area-list').html(str);
					$('.filter-area-item').delegate("a","click",function () {
						$('.filter-area-item').removeClass('filter-area-active');
						$(this).addClass('filter-area-active');
						$('.filter-left h4').html($(this).html());
						$('.filter-left').find('i').addClass('arrow-down');
						$('.filter-left').find('i').removeClass('arrow-up');
						$('.filter-area-list').css('display','none');
						$.ajax({
							url:getUrl()+"wechat114/Hospital/getHospitalInfo",
							data:{"officesName":officesName,"hospitalAddress":$(this).html()},
							dataType:"json",
							type:"get",
							success:function (data) {
								//alert(data.data[0].hospitalName);
								var length = data.data.length;
								var arrList = data.data;
								var str = "";
								for (var i=0; i<length; i++){
									str += "<div class=\"common-item\">\n" +
											"\t\t<div class=\"common-item-top\">\n" +
											"\t\t\t<div class=\"common-logo\">\n" +
											"\t\t\t\t<img src=\"/images/demo.png\"/>\n" +
											"\t\t\t</div>\n" +
											"\t\t\t<div class=\"common-body\">\n" +
											"\t\t\t\t<h4>"+arrList[i].hospitalName+"</h4>\n" +
											"\t\t\t\t<span>"+arrList[i].hospitalLevel+"</span>\n" +
											"\t\t\t</div>\n" +
											"\t\t</div>\n" +
											"\n" +
											"\t\t<div class=\"common-item-bottom\">\n" +
											"\t\t\t<a>"+arrList[i].officesName+"</a>\n" +
											"\t\t</div>\n" +
											"\n" +
											"\t</div>";
								}
								$(".common-list").html(str);
							}
						})
					})
				}
			}
		})
		var name = $(this).find('i').attr('class');
		if(name=='arrow-down'){
			$(this).find('i').removeClass('arrow-down');
			$(this).find('i').addClass('arrow-up');
			$('.filter-area-list').css('display','flex');
		}
		else if(name=='arrow-up'){
			$(this).find('i').addClass('arrow-down');
			$(this).find('i').removeClass('arrow-up');
			$('.filter-area-list').css('display','none');
		}
	})
	/*区域显示ending*/


	$('.filter-area-item').click(function () {
		$('.filter-area-item').removeClass('filter-area-active');
		$(this).addClass('filter-area-active');

		$('.filter-left').find('i').addClass('arrow-down');
		$('.filter-left').find('i').removeClass('arrow-up');
		$('.filter-area-list').css('display','none');
	})
	/*按科室显示医院head*/
	if (officesName=="undefined"){
		$("#search-offics").attr("value","");
	}else{
		$("#search-offics").attr("value",officesName);
	}
	serachoffices(officesName);
	function serachoffices(officesName){

		$.ajax({
			url:getUrl()+"wechat114/Hospital/getHospitalInfo",
			data:{"officesName":officesName},
			dataType:"json",
			type:"get",
			success:function (data) {
				//alert(data.data[0].hospitalName);
				var length = data.data.length;
				var arrList = data.data;
				var str = "";
				for (var i=0; i<length; i++){
					str += "<div class=\"common-item\">\n" +
							"\t\t<div class=\"common-item-top\">\n" +
							"\t\t\t<div class=\"common-logo\">\n" +
							"\t\t\t\t<img src=\""+arrList[i].hospitalImage+"\"/>\n" +
							"\t\t\t</div>\n" +
							"\t\t\t<div class=\"common-body\">\n" +
							"\t\t\t\t<h4>"+arrList[i].hospitalName+"</h4>\n" +
							"\t\t\t\t<span>"+arrList[i].hospitalLevel+"</span>\n" +
							"\t\t\t</div>\n" +
							"\t\t</div>\n" +
							"\n" +
							"\t\t<div class=\"common-item-bottom\">\n" +
							"\t\t\t<a>"+arrList[i].officesName+"</a>\n" +
							"\t\t</div>\n" +
							"\n" +
							"\t</div>";
				}
				$(".common-list").html(str);
			}
		})
	}

	$('.search-icon').click(function () {
		var name = $("#search-offics").val();
		//alert(name);
		serachoffices(name);
	})


	/*按科室显示医院ending*/
</script>

</html>
